package com.filldream.fastboot.web.controller.common;


import com.filldream.fastboot.base.entity.MallCategory;
import com.filldream.fastboot.base.request.IdSTO;
import com.filldream.fastboot.base.request.pc.mallCategory.MallCategoryListSTO;
import com.filldream.fastboot.common.annotation.RepeatRequestAnnotation;
import com.filldream.fastboot.common.entity.R;
import com.filldream.fastboot.core.manager.MallCategoryManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "商品分类")
@RestController
@RequestMapping("/common/mallCategory")
public class MallCategoryController {

    @Autowired
    private MallCategoryManager mallCategoryManager;

    @RepeatRequestAnnotation
    @ApiOperation(value = "商品分类列表")
    @PostMapping("/list")
    public R<List<MallCategory>> list(@RequestBody MallCategoryListSTO mallCategoryListSTO ){
        return mallCategoryManager.list(mallCategoryListSTO);
    }

    @ApiOperation(value = "商品分类详情")
    @PostMapping("/get")
    public R<MallCategory> get(@RequestBody IdSTO idSTO ){
        return R.autoSuccess( mallCategoryManager.getById(idSTO.getId()) );
    }



}
